# -*- coding: utf-8 -*- 
# @Time : 2022/9/29 07:29 
# @Author : junjie
# @File : fun_project.py

from common.fun_response import CaseResponse
from common.fun_exception import except_script_error
from scripts.pity.project import Project

@except_script_error
def create_project(username: str, password: str):
    """
    @api {post} /create_project 自动创建项目
    @apiGroup 项目
    @apiName create_project
    @apiDescription  自动创建pity项目
    @apiPermission fang
    @apiParam {String} username=tester 用户名
    @apiParam {String} password=tester 用户密码
    @apiParamExample {json} 请求示例:
    {
         "username": "tester",
         "password": "tester"
      }
    @apiSuccess (200) {Number} code=200 服务器码
    @apiSuccess (200) {Object} data 造数成功返回相关的数据
    @apiSuccess (200) {String} data.project_name="demo_1664550976" 项目名称
    @apiSuccess (200) {String} msg="造数成功" 提示语
    @apiSuccessExample {json} 返回示例:
    {
        "code": 0,
        "msg": "请求成功",
        "data": {
        "project_name": "demo_1664550976"
        }
    }
    """
    demo = Project()
    data = demo.create(username, password)
    return CaseResponse.success(data = data), demo.logger.generate()